<template>
    <view v-if="value">
        <view class="a-popup-mask" @click="onMaskClick"></view>
        <view class="a-dialog">
            <view class="a-dialog-title" v-if="title">{{title}}</view>
            <slot></slot>
            <view class="a-dialog-action">
                <view class="color-cancel" @click="cancel" v-if="showCancel">取消</view>
                <view class="color-primary" @click="confirm">{{confirmText}}</view>
            </view>
        </view>
    </view>
</template>

<script>
    import Confirm from './my-confirm'

    export default {
        name: "my-dialog",
        mixins: [Confirm],
        props: {
            showCancel: {
                type: Boolean,
                default: false
            },
        },
        methods: {
            confirm() {
                this.$emit('input', false);
                this.$emit('confirm');
            },
        },
    }
</script>

<style scoped lang="less">

</style>
